<template>
  <div class="tmpl">
     <div class="title">
            <h2>{{newscontent.title}}</h2>
            <p>{{newscontent.add_time}}
                &nbsp;{{newscontent.click}}浏览&nbsp;分类:民生经济</p>
        </div>
        <div class="content">
            <p v-html="newscontent.content"></p>
        </div>



        <!-- 显示的子组件 -->
        <subcomment :commentId="this.$route.params.newsId"></subcomment>
  </div>
</template>
<style>
  
</style>
<script>
  
     import common from '../../tools/common.js';

     import sub from '../sub/sub.vue';

     export default {

          data(){
            
            return {

              newscontent:{}
            };
          },

          created(){
              this.getcontent();
          },

          methods:{
              getcontent(){
                const url=common.apihost+'api/getnew/'+this.$route.params.newsId;

                this.$http.get(url).then(res=>{
                    console.log(123);
                    this.newscontent=res.body.message[0];
                },err=>{
                  console.log(err);
                })
              }
          },
          components:{
            subcomment:sub
          }
     }
</script>